	<% link_to @operation, :class => "ui-state-default ui-corner-all dialog_link" do %>
			<span class="ui-icon ui-icon-search"></span>View
	<% end %>&nbsp;
	<% link_to operations_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
		<span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>Back
	<% end %>
<h1>Editing operation</h1>

<% form_for(@operation) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :description %>
    <%= f.text_field :description %>
  </p>
  <p>
    <%= f.label :start_date %>
    <%= f.date_select :start_date %>
  </p>
  <p>
    <%= f.label :end_date %>
    <%= f.date_select :end_date %>
  </p>
  <p>
    <%= f.label :status %>
    <%= f.select(:status, Operation::OPERATION_STATUS.map {|c| [c[1], c[0]] }, :selected => @operation.status)%>
  </p>
  <p>
  <h2>Computers :</h2>
  <table border="2">
  	<tr class="ui-state-default">
  	  <th>Available</th>
  	  <th>Belongs to me</th>
  	</tr>
  	<tr>
  	  <td id='trash_computer'>
	     <% Computer.all.each do |computer| %>
      	   <%if !@operation.computers.include?(computer)%>
		     <%= render :partial => 'operations/operation_computer', :locals => {:computer => computer}%>
      	   <%end%>
		 <% end %>
	  </td>
	  <td id='container_computer'>
		<% Computer.all.each do |computer| %>
			<%if @operation.computers.include?(computer)%>
			  <%= render :partial => 'operations/operation_computer', :locals => {:computer => computer}%>
			<%end%>
		<%end%>
	  </td>
	</tr>
  </table>
  <%= drop_receiving_element('trash_computer',
    :accept => "dragable",
    :with   => "'computer_id=' + (element.id.split('_').last()) + '&operation_id=#{@operation.id.to_s}'",
    :url    => {:action=>:delete_computer}
  )%>
  <%= drop_receiving_element('container_computer',
    :accept => "dragable",
    :with   => "'computer_id=' + (element.id.split('_').last()) + '&operation_id=#{@operation.id.to_s}'",
    :url    => {:action=>:add_computer}
  )%>
  </p>
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>
	<% link_to @operation, :class => "ui-state-default ui-corner-all dialog_link" do %>
			<span class="ui-icon ui-icon-search"></span>View
	<% end %>&nbsp;
	<% link_to operations_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
		<span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>Back
	<% end %>
